package com.wzz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzz.entity.Snatch;
import com.wzz.mapper.SnatchMapper;
import com.wzz.service.SnatchService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@RequiredArgsConstructor
public class SnatchServiceImpl extends ServiceImpl<SnatchMapper, Snatch> implements SnatchService {

    private final SnatchMapper snatchMapper;

    @Override
    public void addSnatch(Snatch snatch) {
        snatchMapper.insert(snatch);
    }

    @Override
    public List<Snatch> getSnatchs() {
        QueryWrapper<Snatch> wrapper = new QueryWrapper<>();
        return snatchMapper.selectList(wrapper);
    }

    @Override
    public void updateSnatch(Integer id, String flag) {
        Snatch snatch=new Snatch();
        snatch.setId(id);
        snatchMapper.updateById(snatch);

    }
}
